Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@formatjs/intl

Package Overview
Dependencies
Maintainers
3
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formatjs/intl

Internationalize JS apps. This library provides an API to format dates, numbers, and strings, including pluralization and handling translations.

  • 2.10.15
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.4M
increased by4.69%
Maintainers
3
Weekly downloads
 
Created

What is @formatjs/intl?

@formatjs/intl is a collection of internationalization (i18n) libraries that help you format dates, numbers, and strings for different locales. It provides a comprehensive set of tools to handle localization in JavaScript applications.

What are @formatjs/intl's main functionalities?

Date Formatting

This feature allows you to format dates according to different locales. The code sample demonstrates how to format a date in the 'en-US' locale.

const { IntlDateTimeFormat } = require('@formatjs/intl');
const date = new Date();
const formatter = new IntlDateTimeFormat('en-US', { year: 'numeric', month: 'long', day: 'numeric' });
console.log(formatter.format(date)); // Output: October 5, 2023

Number Formatting

This feature allows you to format numbers according to different locales and styles. The code sample demonstrates how to format a number as a currency in the 'de-DE' locale.

const { IntlNumberFormat } = require('@formatjs/intl');
const number = 1234567.89;
const formatter = new IntlNumberFormat('de-DE', { style: 'currency', currency: 'EUR' });
console.log(formatter.format(number)); // Output: 1.234.567,89 €

Message Formatting

This feature allows you to format messages with placeholders that can be replaced with dynamic values. The code sample demonstrates how to format a message with a placeholder for a name.

const { IntlMessageFormat } = require('@formatjs/intl');
const message = new IntlMessageFormat('Hello, {name}!', 'en-US');
console.log(message.format({ name: 'John' })); // Output: Hello, John!

Other packages similar to @formatjs/intl

Keywords

FAQs

Package last updated on 18 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc